package com.xsg.printer.core.enums;

import com.xsg.printer.core.toolkit.ImageLinePaint;

import java.awt.*;

public enum BorderStyleEnum {

    NONE(0, "不画线", null),

    FULL(1, "实线", ImageLinePaint.getFullDraw()),

    DASHED(2, "虚线", ImageLinePaint.getDashedDraw()),

    WAVE(3, "波浪线", ImageLinePaint.getWaveDraw()),
    ;

    private Integer type;

    private String name;

    private ImageLinePaint.DrawLine<Graphics2D> imageValue;

    BorderStyleEnum(int type, String name, ImageLinePaint.DrawLine<Graphics2D> imageValue) {
        this.type = type;
        this.name = name;
        this.imageValue = imageValue;
    }

    public Integer getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public ImageLinePaint.DrawLine<Graphics2D> getImageValue() {
        return imageValue;
    }

    public static BorderStyleEnum getEnumByType(Integer type) {
        for (BorderStyleEnum value : values()) {
            if(value.getType().equals(type)){
                return value;
            }
        }
        return BorderStyleEnum.NONE;
    }
}
